package com.example.knowing_project.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import lombok.Data;

/**
 * 电子书
 * @TableName ebook
 */
@TableName(value ="ebook")
@Data
public class Ebook implements Serializable {
    /**
     * id
     */
    @TableId
    private Long id;

    /**
     * 名称
     */
    private String name;

    /**
     * 分类1
     */
    private Long category1_id;

    /**
     * 分类2
     */
    private Long category2_id;

    /**
     * 描述
     */
    private String description;

    /**
     * 封面
     */
    private String cover;

    /**
     * 文档数
     */
    private Integer doc_count;

    /**
     * 阅读数
     */
    private Integer view_count;

    /**
     * 点赞数
     */
    private Integer vote_count;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Ebook other = (Ebook) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
            && (this.getCategory1_id() == null ? other.getCategory1_id() == null : this.getCategory1_id().equals(other.getCategory1_id()))
            && (this.getCategory2_id() == null ? other.getCategory2_id() == null : this.getCategory2_id().equals(other.getCategory2_id()))
            && (this.getDescription() == null ? other.getDescription() == null : this.getDescription().equals(other.getDescription()))
            && (this.getCover() == null ? other.getCover() == null : this.getCover().equals(other.getCover()))
            && (this.getDoc_count() == null ? other.getDoc_count() == null : this.getDoc_count().equals(other.getDoc_count()))
            && (this.getView_count() == null ? other.getView_count() == null : this.getView_count().equals(other.getView_count()))
            && (this.getVote_count() == null ? other.getVote_count() == null : this.getVote_count().equals(other.getVote_count()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
        result = prime * result + ((getCategory1_id() == null) ? 0 : getCategory1_id().hashCode());
        result = prime * result + ((getCategory2_id() == null) ? 0 : getCategory2_id().hashCode());
        result = prime * result + ((getDescription() == null) ? 0 : getDescription().hashCode());
        result = prime * result + ((getCover() == null) ? 0 : getCover().hashCode());
        result = prime * result + ((getDoc_count() == null) ? 0 : getDoc_count().hashCode());
        result = prime * result + ((getView_count() == null) ? 0 : getView_count().hashCode());
        result = prime * result + ((getVote_count() == null) ? 0 : getVote_count().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", name=").append(name);
        sb.append(", category1_id=").append(category1_id);
        sb.append(", category2_id=").append(category2_id);
        sb.append(", description=").append(description);
        sb.append(", cover=").append(cover);
        sb.append(", doc_count=").append(doc_count);
        sb.append(", view_count=").append(view_count);
        sb.append(", vote_count=").append(vote_count);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}